//
//  TTMusicDiscoveryPageFifthCollectionViewCell.m
//  TTMusic
//
//  Created by chenpengyu on 16/3/31.
//  Copyright © 2016年 cpy. All rights reserved.
//

#import "TTMusicDiscoveryPageFifthCollectionViewCell.h"

@implementation TTMusicDiscoveryPageFifthCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.titleLabel=[[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(150, 10, 220, 30)];
        self.descLabel=[[TTMusicBaseLabel alloc] initWithFrame:CGRectMake(150, 40, 220, 30)];
        self.picImageView=[[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 120, 80)];
        [self updateFrame:_titleLabel];
        [self updateFrame:_picImageView];
        [self updateFrame:_descLabel];
        
        [self.contentView addSubview:_picImageView];
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_descLabel];
    }
    return self;
}

- (void)updateFrame:(UIView *)view{
    
    CGRect rect = view.frame;
    view.frame = CGRectMake(rect.origin.x * FitWidth, rect.origin.y * FitWidth, rect.size.width * FitWidth, rect.size.height * FitWidth);
}
- (void)setDataModel:(CPYDiscoveryPageDataModel *)dataModel {
    _dataModel = dataModel;
}
- (void)setDataDetailModel:(CPYDiscoveryPageDataDetailModel *)dataDetailModel {
    _dataDetailModel = dataDetailModel;
    [_picImageView sd_setImageWithURL:[NSURL URLWithString:dataDetailModel.picUrl]];
    _titleLabel.text = dataDetailModel.name;
    _descLabel.text = dataDetailModel.desc;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
